define(['app'], function(app) {
	'use strict';

	//实例化方法
	var factory = function(Http) {
	    /**
         * 一键切换数据获取方式
         * @param {Object} result
         */
        function get_data_getlist(result){
            if(HTTP_ISLOGIC){
                result='{"success":true,"msg":"","result":{"act_id":"001","order":['+
                '{"order_id":"001","member_id":"001","name":"张三","region":"北京","is_answer":"yes"},'+
                '{"order_id":"002","member_id":"001","name":"张三","region":"上海","is_answer":"no"}]},"session": "7311da98bd0f18eb15a96bcb263f4153"}';
                return JSON.parse(result);
            }else{
                return result;
            }
        }

		//返回信息
		return {
		    //获取问卷信息
            getlist:function(act_id,member,member_id,callback){
                Http.post({
                    method:'marketing.goodstest.prize',
                    session:'',
                    act_id:act_id,
                    member:member,
                    member_id:member_id
                },
                function(result){
                    //请求不成功
                    if(callback)
                        callback(get_data_getlist(result).result);
                },
                function(e){
                    //请求异常
                },
                function(){
                    //请求完成，一般不做什么事情
                });
            },
            
            //确定接受问卷
            agree:function(act_id,order,callback){
                Http.post({
                    method:'marketing.goodstest.agree',
                    session:'',
                    act_id:act_id,
                    order:order,
                },
                function(result){
                    //请求不成功
                    if(callback)
                        callback(get_data_getlist(result).result);
                },
                function(e){
                    //请求异常
                },
                function(){
                    //请求完成，一般不做什么事情
                });
            }
            
            
            
		};
	}

	factory.$inject = ['Http'];
	return app.registerService("Lookinto", factory);
});